﻿/// File: Robotics4.NET\BodyMap\InterfaceEntry.cs
/// 
/// ------------------------------------------------------------
/// Copyright (c) 2004
///   Antonio Cisternino (cisterni.unipi.it),
///   Diego Colombo      (colombod.unipi.it)
/// 
/// The use and distribution terms for this software are 
/// contained in the file named license.txt, which can be found 
/// in the root of this distribution.
/// By using this software in any fashion, you are agreeing to 
/// be bound by the terms of this license.
///
/// You must not remove this notice, or any other, from this
/// software.
/// ------------------------------------------------------------
#region Using directives

using System;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;


#endregion

namespace Robotics4.NET
{
    [Serializable]
    public class InterfaceEntry
    {
        public RobletMessage Message = null;
        public XmlSchema Schema = null;
    }

    public class XSDGenerator
    {
        public static XmlSchema Generate(Type t)
        {
            XmlReflectionImporter importer1 = new XmlReflectionImporter();
            XmlSchemas schemas = new XmlSchemas();
            XmlSchemaExporter exporter1 = new XmlSchemaExporter(schemas);
            XmlTypeMapping mapping1 = importer1.ImportTypeMapping(t);
            exporter1.ExportTypeMapping(mapping1);
            schemas.Compile(null,true);
            return schemas[0];
        }
    }
}
